<template>
	<view class="container">
		<view class="header">
			<view class="title">
				将此{{title}}推荐给
			</view>
			<image @click="close" class="icon-42" src="../../static/btn_close.png" mode="widthFix"></image>
		</view>
		<scroll-view class="list" scroll-y="true">
			<view class="user-list">
				<view class="item" v-for="(item,i) in allMemberList" :key="i" @click="goDetail(item.userID)">
					<image class="avatar" :src="item.avatar" mode=""></image>
					<view class="name line-clamp">
						{{item.nick}}
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	// 直播间类型:1=线路,2=包车,3=租车
	export default {
		name: "n-recommend",
		data() {
			return {

			};
		},
		props: {
			allMemberList: {
				type: Array,
				default: () => {
					return []
				}
			},
			title:{
				type: [String],
				default: '线路'
			},
			type: {
				type: [String],
				default: ''
			},
			liveId:{
				type: [String,Number],
				default: ''
			},
			recommendId:{
				type: [String,Number],
				default: ''
			}
		},
		methods: {
			close() {
				this.$emit('close')
			},
			goDetail(id) {
				let data = {}
				if(this.type==1){
					data = {
						live_id:this.liveId,
						be_user_id:id,
						itinerary_id:this.recommendId,
						type:this.type
					}
				}
				if(this.type==2){
					data = {
						live_id:this.liveId,
						be_user_id:id,
						chartered_id:this.recommendId,
						type:this.type
					}
				}
				if(this.type==3){
					data = {
						live_id:this.liveId,
						be_user_id:id,
						car_rental_id:this.recommendId,
						type:this.type
					}
				}
				this.$api.liveTjgqtr(data).then(res=>{
					this.$tools.toast(res.msg)
					if(res.code==1){
						this.$emit('click')
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.container {
		background: #F5F5F5;
	}

	.header {
		position: relative;
		padding-top: 46upx;

		.title {
			font-size: 32upx;
			font-weight: 500;
			color: #333333;
			text-align: center
		}

		.icon-42 {
			position: absolute;
			right: 40upx;
			top: 46upx;
		}
	}

	.list {
		max-height: 1000upx;
		padding: 30upx;
		box-sizing: border-box;

		.user-list {
			@include menu-list(5);
			.item {
				text-align: center;
				@include flex-col;
				align-items: center;
				margin-bottom: 50upx;
				.avatar {
					width: 88upx;
					height: 88upx;
					border: 2upx solid #519D76;
					border-radius: 50%;
				}
			
				.name {
					font-size: 28upx;
					font-weight: 400;
					color: #333333;
					width: 90upx;
					margin-top: 10upx;
				}
			
			}
		}

		
	}
</style>
